﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _0517
{
    public partial class frmReg : Form
    {
        public frmReg()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmLogin log = new frmLogin();
            log.Show();
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == textBox3.Text)
            {
                string sex;
                if (radioButton1.Checked)
                    sex = "女";
                else
                    sex = "男";
                string strSql;
                _0517病例系统.DataAccess data = new _0517病例系统.DataAccess();
                strSql = "insert into Usery(ID,Pwd,RName,PhoneNum,Sex,Birthday) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + sex + "','" + dateTimePicker1.Text + "')";
                data.dataCon();
                if (data.sqlExec(strSql))
                {
                    MessageBox.Show("注册成功！");
                    this.Hide();
                    frmLogin f1 = new frmLogin();
                    f1.Show();
                }
                else
                {
                    MessageBox.Show("注册失败！");
                }
            }
            else
                MessageBox.Show("两次密码输入，请重新输入！", "提示");

            
        }
    }
}
